may need a bit more practice and help#10
may need a bit more practice and help#10mikeadeleke wants to merge 3 commits intoRubyoffRails:masterfrom
Conversation
Yes, in all TDD you should go Red, Green, Refactor:
|
train_spec.rb
Outdated
There was a problem hiding this comment.
Here you are not performing any actions or calling any methods.
All you are doing with this message expectation is saying that for this test to pass, the message_board should receive a call of slow_down!
The normal flow here would be to then execute some code to see if it happened.
it "should receive slow down from conductor" do
message_board.should_receive(:slow_down!)
conductor.see_danger_coming!
end|
You could specify the exact argument you want. For example, if you wanted to make sure the AnswerBank received the answer 42, you could: answer_bank.should_receive(:record_answer).with(42)By default, it will accept "any_arguments" if you do not specifiy. |
train_spec.rb
Outdated
There was a problem hiding this comment.
Is this a valid specification?
It COULD be, if you write it. That is, if you created a customer matcher... But you didn't, so you got an error about a "matcher"
|
Hmmm. Okay, how do my tests look? Am I on the right track? |
|
Yep, you're on the right track! |
|
Sorry I am dong so many at one time but wanted to go over some core concepts before I got started with my MVP. I'm looking into "any args" and am only getting more confused. Do you suggest any resources or am I over-thinking this? |
|
IMHO you are way over-thinking this. But, if you want to see the documentation: https://www.relishapp.com/rspec/rspec-mocks/docs/message-expectations/expect-message-using-should-receive#expect-a-message-with-an-argument |
|
Hmm. How am I over-thinking this? |
|
because any_args simply doesn't matter On Mon, Feb 17, 2014 at 10:55 PM, Mike Adeleke [email protected]
|

I'm wondering in RSpec if the previous tests pass before you move on to next test. That way, I can see that since Engineer and Conductor have already had their actions I do not need them again in MessageBoard. But then, I seem to get the wrong number of arguementts and don't exactly know what I should be passing in.
